package com.lo.dao;


import com.lo.entity.Teacher;
import com.lo.entity.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserMapper {
    int insert(User user);
    List<User> selectByUsernameAndPassword(@Param("username")String username, @Param("password") String password );
    //检索审核通过课程，新改
    List<User> selectByTidAndExamined(@Param("id") Long tid,@Param("search") String search);
    //检索未通过审核
    List<User> selectByTidAndNotExamine(@Param("id") Long tid, @Param("search") String search);
    //根据id检索用户
    List<User> selectById(@Param("id") Long id);
    List<User> selectPersonalInfoById(@Param("id") Long id);
    List<User> selectByUsername(@Param("username") String username);

    int deleteById(@Param("id") Long id);

    //更新用户信息
    int updateMessage(User user);

    //获取全部用户
    List<User> selectAllUsers();
    //获取全部教师用户
    List<User> selectAllTeachers();
    //设置禁用
    int updateIsBanned2One(@Param("id") Long id);
    //设置启用
    int updateIsBanned2Zero(@Param("id") Long id);



    Long userCount();

    Long userOrdinaryCount();

    Long userVipCount();
    //教师人数迁移过来的函数
    Long teacherCount();
    Long teacherOrdinaryCount();
    Long teacherVipCount();



    Long updateIsTeacher2Zero(@Param("id") Long id);
    Long updateIsTeacher2One(User user);
    Long updateIsTeacher2Two(@Param("id") Long id);

    List<User> selectIsTeacherEOne(@Param("search") String search);

    List<User> selectIsTeacherETwo(@Param("id") Long id);

    List<User> selectByUsernameAndPhone(@Param("username") String username,@Param("phone") String phone);

    int updatePasswordById(@Param("id") Long id,@Param("password") String password);

    List<User> selectTextByTidAndExamined(Long id, String search);

    List<User> selecTexttByTidAndNotExamine(Long id, String search);
}
